package com.snailct.bpp.router.datachange;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by huangxa on 2016/6/17.
 */
public class MessageNodeOpertaion {
    private List<MessageNode> nodeArray;

    public void setNodeArray(List<MessageNode> nodeArray) {
        this.nodeArray = nodeArray;
    }

    public List<MessageNode> findParentNodeArray() {
        List<MessageNode> parentNodes = new ArrayList<MessageNode>();
        for(MessageNode parentNode : nodeArray){
            if("false".equals(parentNode.getIsBottom())){
                parentNodes.add(parentNode);
            }
        }
        return parentNodes;
    }

    public List<MessageNode> findSonNodeArray(MessageNode currentNode) {
        List<MessageNode> sonNodes = new ArrayList<MessageNode>();
        for(MessageNode node : nodeArray){
            if(node.getParentElementName().equals(currentNode.getCurrentElementName())){
                sonNodes.add(node);
            }
        }
        return sonNodes;
    }
}
